package lagou.homework.lagouhomework.Unit2.q3.code;

public class TaskTest {
    public static void main(String[] args) {

        //定义一张手机卡类

        PhoneCard pc1 = new PhoneCard(CardType.BIG,"12345678901","GJC", "********", 1000.0, 0, 50);

        pc1.phoneCardShow();

        //定义套餐类（通话类），测试多态
        System.out.println("------------------------------------");
        Packages p1 = new CallPackage(200, 500, 30);  // 测试多态, 父类对象引用指向子类对象
        p1.showInfo();

        //定义套餐类（上网类）,测试多态
        Packages p2 = new NetPackage(100, 200.0);  // 测试多态, 父类对象引用指向子类对象
        p2.showInfo();


        //  测试继承
        System.out.println("------------------------------------");
        if(p1 instanceof CallPackage) {

            ((CallPackage) p1).callService(60, pc1);

            pc1.showInfo();

        }

        if(p2 instanceof  NetPackage) {

            ((NetPackage) p2).netService(100, pc1);

            pc1.showInfo();

        }

    }

}
